package day_2022_4_to_7.day48;
import java.util.*;

/**
 * 杨辉三角的变形
 * @author haomin
 * @date 2022/05/13 23:23
 **/
public class Day17_1_YangHui {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        if(n<=2)
            System.out.println(-1);
        else if(n%2==1){
            System.out.println(2);
        }else{
            if(n%4==0)
                System.out.println(3);
            else
                System.out.println(4);
        }
    }
}